from typing import Optional, List, Union
from pydantic import BaseModel, ConfigDict
from datetime import datetime

class WorkflowShareBase(BaseModel):
    workflow_id: int
    user_id: Optional[int] = None
    is_public: bool = False

class WorkflowShareCreate(WorkflowShareBase):
    pass

class WorkflowShareUpdate(WorkflowShareBase):
    pass

class WorkflowShareInDBBase(WorkflowShareBase):
    id: int
    created_at: datetime

    model_config = ConfigDict(from_attributes=True)

class WorkflowShare(WorkflowShareInDBBase):
    pass

class WorkflowShareResponse(WorkflowShareInDBBase):
    pass

# 用于共享工作流给多个用户的请求模型
class ShareWorkflowRequest(BaseModel):
    user_ids: Optional[List[int]] = None
    is_public: bool = False 